{extend name='admin@public/content'}

{block name="button"}


<!--{if auth("$classuri/del")}-->
<!--<button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-sm layui-btn-danger'>批量删除</button>-->
<!--{/if}-->

{/block}

{block name="content"}

<link rel="stylesheet" href="/static/theme/css/data.css?at=1125">
<div class="layui-row layui-col-space20 portal-block-container notselect">

    <div class="layui-col-sm6 layui-col-md2">
        <div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#ff7d7d,#fb2c95)">
            <div>抽奖总数</div>
            <div>{$lottery_total}次</div>
            <div>全部抽奖次数</div>
        </div>
        <i class="portal-block-icon layui-icon "></i>
    </div>
    <div class="layui-col-sm5 layui-col-md2">
        <div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#ff7d7d,#fb2c95)">
            <div>一等奖</div>
            <div>{$first}个</div>
            <div>全部一等奖中奖个数</div>
        </div>
        <i class="portal-block-icon layui-icon "></i>
    </div>
    <div class="layui-col-sm6 layui-col-md2">
        <div class="portal-block-item nowrap" style="background:linear-gradient(-113deg,#c543d8,#925cc3)">
            <div>二等奖</div>
            <div>{$second}个</div>
            <div>全部二等奖中奖个数</div>
        </div>
        <i class="portal-block-icon layui-icon "></i></div>
    <div class="layui-col-sm6 layui-col-md2">
        <div class="portal-block-item nowrap" style="background:linear-gradient(-141deg,#ecca1b,#f39526)">
            <div>三等奖</div>
            <div>{$third}个</div>
            <div>全部三等奖中奖个数</div>
        </div>
        <i class="portal-block-icon layui-icon "></i>
    </div>
    <div class="layui-col-sm6 layui-col-md2">
        <div class="portal-block-item nowrap" style="background:linear-gradient(-125deg,#57bdbf,#2f9de2)">
            <div>四等奖</div>
            <div>{$four}个</div>
            <div>全部四等奖中奖个数</div>
        </div>
        <i class="portal-block-icon layui-icon "></i>
    </div>

    <div class="layui-col-sm6 layui-col-md2">
        <div class="portal-block-item nowrap" style="background:linear-gradient(-113deg,#c543d8,#925cc3)">
            <div>现金红包</div>
            <div>{$redpacket}元</div>
            <div>全部发出的现金红包金额</div>
        </div>
        <i class="portal-block-icon layui-icon "></i>
    </div>
</div>

<!-- 表单搜索 开始 -->
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">

    <!--<div class="layui-form-item layui-inline">
        <label class="layui-form-label">核销码</label>
        <div class="layui-input-inline">
            <input name="sn" value="{$Think.get.sn}" placeholder="请输入核销码" class="layui-input">
        </div>
    </div>-->

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">用户识别码</label>
        <div class="layui-input-inline">
            <input name="wecha_id" value="{$Think.get.wecha_id}" placeholder="请输入用户识别码" class="layui-input">
        </div>
    </div>

    <!--<div class="layui-form-item layui-inline">
        <label class="layui-form-label">奖励类型</label>
        <div class="layui-input-inline">
            <select name="typeid" class="layui-select">
                <option value="">所有</option>
                &lt;!&ndash;{foreach ['1'=>"中奖",'2'=>"报名"] as $k=>$v}&ndash;&gt;
                {if $Think.get.typeid eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                &lt;!&ndash;{/foreach}&ndash;&gt;
            </select>
        </div>
    </div>-->

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">中奖类型</label>
        <div class="layui-input-inline">
            <select name="prize" class="layui-select">
                <option value="">所有</option>
                <!--{foreach ['1'=>"一等奖",'2'=>"二等奖",'3'=>"三等奖",'4'=>"四等奖"] as $k=>$v}-->
                {if $Think.get.prize eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">是否中奖</label>
        <div class="layui-input-inline">
            <select name="islottery" class="layui-select">
                <option value="">所有</option>
                <!--{foreach ['0'=>"否",'1'=>"是"] as $k=>$v}-->
                {if $Think.get.islottery eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">核销状态</label>
        <div class="layui-input-inline">
            <select name="sendstutas" class="layui-select">
                <option value="">所有</option>
                <!--{foreach ["待核销","已核销"] as $k=>$v}-->
                {if $Think.get.sendstutas eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <!--{if !empty($cates)}-->
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">项目分类</label>
        <div class="layui-input-inline">
            <select name="cate_id" lay-search>
                <option value="">所有分类</option>
                {foreach $cates as $cate}
                <!--{if $Think.get.cate_id eq $cate.cate_id}-->
                <option selected="selected" value="{$cate.cate_id}">{$cate.spl|raw}{$cate.name}</option>
                <!--{else}-->
                <option value="{$cate.cate_id}">{$cate.spl|raw}{$cate.name}</option>
                <!--{/if}-->
                {/foreach}
            </select>
        </div>
    </div>
    <!--{/if}-->

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">发放时间</label>
        <div class="layui-input-inline">
            <input name="time" id="time" value="{$Think.get.time}" placeholder="请选择奖励时间" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">核销时间</label>
        <div class="layui-input-inline">
            <input name="sendtime" id="sendtime" value="{$Think.get.sendtime}" placeholder="请选择核销时间" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>
    <!--{if auth("$classuri/outItems")}-->
    <div class="layui-form-item layui-inline">
        <button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="outOrders"><i
                class="layui-icon">&#xe601;</i> 导 出Excel
        </button>
    </div>
    <!--{/if}-->
</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});

    //监听提交
    form.on('submit(outOrders)', function (data) {
        params = data.field;
        layer.confirm('确认要导出吗？', function () {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            })
            var url = "{:url('admin/lottery/outItems')}";
            DownLoad({ //调用下载方法
                url: url, data: params
            });
            layer.closeAll(); //关闭所有层

        });
    });

    /*通用下载导出*/
    function DownLoad(options) {
        var config = $.extend(true, {method: 'post'}, options);
        var $iframe = $('<iframe id="down-file-iframe" />');
        var $form = $('<form target="down-file-iframe" method="' + config.method + '" />');
        $form.attr('action', config.url);
        for (var key in config.data) {
            $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />');
        }
        $iframe.append($form);
        $(document.body).append($iframe);
        $form[0].submit();
        $iframe.remove();
    }
</script>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    <!--{if empty($list)}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table notevent" lay-skin="line">
        <thead>
        <tr>
            <th class="nowrap">ID</th>
            <th class="nowrap">识别码</th>
            <th class="nowrap">类型</th>
            <th class="nowrap">是否中奖</th>
            <th class="nowrap">收货信息</th>
            <th class="nowrap">券码</th>
            <th class="nowrap">奖项</th>
            <th class="nowrap">中奖名称</th>
            <th class="nowrap">备注</th>
            <th class="nowrap">发放时间</th>
            <th class="text-left">核销时间 / 状态</th>
            <th class='text-center'></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-sort-td text-top'>
                {$vo.id}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.wecha_id}
            </td>
            <td class="text-left nowrap text-top">
                {switch name='vo.typeid'}
                {case value='1'}抽奖{/case}
                {case value='2'}报名{/case}
                {/switch}
            </td>
            <td class="text-left  text-top">
                {switch name='vo.islottery'}
                {case value='0'}<span class="layui-badge layui-bg-gray">✖</span>{/case}
                {case value='1'}<span class="layui-badge layui-bg-blue">✔</span>{/case}
                {/switch}
            </td>
            <td class="text-left  text-top" style="max-width: 10%">
                {$vo.name}<br>{$vo.phone}<br>{$vo.address}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.sn}
            </td>
            <td class="text-left nowrap text-top">
                {switch name='vo.prize'}
                {case value='0'}-{/case}
                {case value='1'}一等奖{/case}
                {case value='2'}二等奖{/case}
                {case value='3'}三等奖{/case}
                {case value='4'}幸运奖{/case}
                {/switch}
            </td>
            <td class="text-left nowrap text-top">
                {$vo.note}
            </td>
            <td class="text-left nowrap text-top">
                {if $vo.prize == 3}{$vo.remark}元{/if}
            </td>
            <td class='text-left nowrap text-top'>
                {:date('Y-m-d H:i:s',$vo.time)}
            </td>
            <td class='text-left nowrap text-top'>
                {if $vo.islottery}
                {if $vo.sendtime}
                {:date('Y-m-d H:i:s',$vo.sendtime)}/已核销
                {else}
                ----------/待核销
                {/if}

                {else}
                {/if}
            </td>

            <td class='text-center nowrap text-top'>

                <!--{if auth('$classuri/verify') and $vo.islottery and $vo.sendstutas eq 0}-->
                <a data-title="核销" data-confirm="确定要核销吗?" data-update="{$vo.id}" data-field='status' data-value='1'
                   data-action='{:url("$classuri/verify")}'><span class="layui-badge">核销</span></a>
                <!--{/if}-->

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/if}-->
</form>
<script>
    (function () {
        window.form.render();
        window.laydate.render({range: true, elem: '#time'});
        window.laydate.render({range: true, elem: '#sendtime'});
    })();
</script>
<style>
    .headimg {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        margin-right: 10px;
    }

</style>
{/block}